let socket = document.querySelector('#socket')
var timer = null
socket.addEventListener('click',function(){
    if(timer){
        return
    }
    timer = setInterval(function(){ 
        let y = document.documentElement.scrollTop
        let sy = parseInt(getComputedStyle(socket).bottom)
        if(y <= 50){
            document.documentElement.scrollTop = 0
            
            
            clearInterval(timer)
            timer = null
            socket.style.bottom = '50px'

        }else{
        socket.style.bottom = sy + 30 + 'px'
        document.documentElement.scrollTop -= 50
        }
    },16)
})

// socket.addEventListener('mouseenter',function(){
//     var timer = setInterval(function(){
//         socket.style.transform()
//     },16)
// })

document.addEventListener('scroll',function(){
    if(document.documentElement.scrollTop >= 50){
        socket.style.display = 'block'
    }else{
        socket.style.display = 'none'
    }
})